import {
  Middleware,
  NestMiddleware,
  ExpressMiddleware,
  Logger,
} from '@nestjs/common';
import { Request, Response, NextFunction } from 'express';
/**
 * 日志中间件   （不重要，可不看）
 *
 * @export
 * @class LoggerMiddleware
 * @implements {NestMiddleware}
 */
@Middleware()
export class LoggerMiddleware implements NestMiddleware {
  resolve(name: string): ExpressMiddleware {
    return (req: Request, res: Response, next: NextFunction) => {
      next();
      Logger.log(`this is middleware working`, 'AppMiddleware', true);
    };
  }
}
